JavaScript

A5.u.objecteach Method

Syntax

A5.u.object.each(object,function)

Arguments

objectobjectarray

The object or array to iterate over.

functionfunction

The function to call with the data from each item.

Returns

resultarray

An array that the passed in function can dynamically add to.

Description

Iterate over each entry in an array of object, and all entries in child arrays or object, and call a function for each item.

Example

var data = [{name: 'Bob', age: 54},{name: 'Fred', age: 32}];
var names = A5.u.object.each(data,function(itemName,value,path,result){
		if(itemName == 'name'){
			result.push(value.toUpperCase());
		}
	});
// names = ['BOB','FRED'];